<!doctype html>
<html ng-app="project">
  <head>
  
    <!-- script src="http://code.angularjs.org/angular-1.0.1.min.js" script -->
    
    <script src="${resource(dir:'js/jquery', file:'jquery-1.7.2.min.js')}"></script>
    <script src="${resource(dir:'js/angular', file:'angular-1.0.1.js')}"></script>
    
    <script src="${resource(dir:'bootstrap/js', file:'bootstrap.js')}"></script>
	<script src="${resource(dir:'kickstart/js', file:'kickstart.js')}"></script>
		
		
		
    <script type="text/javascript">


  
    
    angular.module('project', []).
    config(function($routeProvider) {
      $routeProvider.
        when('/', {controller:ListCtrl, templateUrl:'/AngularGrails/angular/partialList'}).
        when('/edit/:projectName', {controller:EditCtrl, templateUrl:'/AngularGrails/angular/partialDetail'}).
        when('/new', {controller:CreateCtrl, templateUrl:'/AngularGrails/angular/partialDetail'}).
        otherwise({redirectTo:'/'});
    });
   
   
  function ListCtrl($scope) {
    $scope.projects = [
                       {name:'angular'        , site: 'http://angularjs.org', description: 'Angular Framework'},
                       {name:'backbone'        , site: 'http://backbone.org', description: 'Backbone Framework'},
                       {name:'knockout'        , site: 'http://knockout.org', description: 'KnockOut Framework'}
	                  ];
  }
   
   
  function CreateCtrl($scope, $location) {
    $scope.save = function() {
      alert("Salvou");
    }
  }
   
   
  function EditCtrl($scope, $location, $routeParams) {
    var self = this;
   
   
    $scope.isClean = function() {
      return angular.equals(self.original, $scope.project);
    }
   
    $scope.destroy = function() {
      self.original.destroy(function() {
        $location.path('/list');
      });
    };
   
    $scope.save = function() {

    };
  }





    </script>
    
  </head>
  <body>
    <h2>JavaScript Projects</h2>
    <div ng-view></div>
  </body>
</html>